<template>
    <view class="webview-container">
        <!-- #ifdef MP-WEIXIN -->
        <web-view :src="url"></web-view>
        <!-- #endif -->
        <!-- #ifdef H5 -->
        <iframe :src="url" frameborder="0" class="h5-iframe"></iframe>
        <!-- #endif -->
    </view>
</template>

<script>
export default {
    data() {
        return {
            url: ''
        }
    },
    onLoad(options) {
        this.url = decodeURIComponent(options.url || '');

        // #ifdef H5
        // H5端直接跳转，不使用iframe
        window.location.href = this.url;
        // #endif
    }
}
</script>

<style>
.webview-container {
    width: 100%;
    height: 100vh;
}

.h5-iframe {
    width: 100%;
    height: 100%;
}
</style>